
clear

global filetree /Users/Allan/Dropbox/!!Papers/Liberal Peace/12-02-21_ISQ_commentary/DOR_ISQ_2013_Replication/M_Rep

log using "12-11-23_log", text replace

set seed 74928348
cd "$filetree"

*The next section will also take some time. 
do "12-06-19_mimputation.do"


***Mousseau Analysis***
*This file confirms that Mousseau 2013 analysis can be precisely replicated from these files
clear
cd "$filetree"
do "12-06-23_MM_analysis.do"



***Analysis***
clear
cd "$filetree"
**Running robustness specifications on MM data.
do "12-09-23_looprobustness.do"
*This produces robustness1.dta and robustness3.dta

do "12-09-24_bdmrobustness.do"
*This produces robustnessbdm.dta and robustnessbdm2.dta

do "12-09-24_h10dmrobustness.do"
*This produces robustnessh10dm.dta and robustnessh10dm2.dta

***Running robustness specifications on Multiply Imputed data.***
clear
do "12-09-24_loop_mi_robustness.do"
*Produces: robustnessMdml.dta

do "12-09-24_loop_mi_robustness_bdm.do"
*Produces: robustnessMbdm.dta

do "12-09-24_loop_mi_robustness_h10dm.do"
*Produces: robustnessMh10dm.dta

***Outputting final data***
clear
use "robustness1.dta"
append using "robustnessMdml.dta"
append using "robustness3.dta"
replace specnumber=_n
format DmlCoefficient %12.6f
format DmlSE %12.6f
format CIElCoefficient %12.6f
format CIElSE %12.6f
format Dmlpvalues %12.6f
format CIElpvalues %12.6f
saveold "pvalues.dta", replace


**Final Data for bdm

clear
use "robustnessbdm.dta"
append using "robustnessbdm2.dta"
append using "robustnessMbdm.dta"
* replace specification=specification+"'" if _n>23
replace specnumber=_n
format bdmCoefficient %12.6f
format bdmSE %12.6f
format CIElCoefficient %12.6f
format CIElSE %12.6f
format bdmpvalues %12.6f
format CIElpvalues %12.6f
saveold "pvaluesbdm.dta", replace


**Final Data for h10dm
clear
use "robustnessh10dm.dta"
append using "robustnessh10dm2.dta"
append using "robustnessMh10dm.dta"
* replace specification=specification+"'" if _n<=23
* replace specification=specification+"''" if _n>23
replace specnumber=_n
format h10dmCoefficient %12.6f
format h10dmSE %12.6f
format CIElCoefficient %12.6f
format CIElSE %12.6f
format h10dmpvalues %12.6f
format CIElpvalues %12.6f
saveold "pvaluesh10dm.dta", replace

capture log close

**See "12-09-25_overall_analysis.r" for some calculations
**To Make Figures, run "12-09-25_pvalue_plot.r" , "12-09-25_pvalue_plot_bdm.r" 
"12-09-25_pvalue_plot_h10dm.r" , "12-09-25_pvalue_plotCIE.r"